﻿@using Abp.Authorization.Users
@using DualControl.Web.Startup
@using DualControl.CommonServices
@using X.PagedList.Mvc.Core; @*import this so we get our HTML Helper*@
@using X.PagedList; @*import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@

@*@inject ICommonService CommonService*@

@{
    ViewBag.CurrentPageName = PageNames.Users; // The menu item will be active for this page.
}
@section scripts
    {
    <environment names="Development">
        <script src="~/view-resources/Views/Users/UserPostAndOrg.js" asp-append-version="true"></script>
    </environment>

    <environment names="Staging,Production">
        <script src="~/view-resources/Views/Users/UserPostAndOrg.min.js" asp-append-version="true"></script>
    </environment>
}
<div class="row clearfix">
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="card">
            <div class="header">
                <h2>
                    @L("Users")
                </h2>
                <ul class="header-dropdown m-r--5">
                    <li class="dropdown">
                        <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                            <i class="material-icons">more_vert</i>
                        </a>
                        <ul class="dropdown-menu pull-right">
                            <li><a id="RefreshButton" href="javascript:void(0);" class="waves-effect waves-block"><i class="material-icons">refresh</i>@L("Refresh")</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="body table-responsive">
                <table class="table">
                    <thead>
                        <tr>
                            <th>用户名</th>
                            <th>真实姓名</th>
                            <th>部门</th>
                            <th>岗位</th>
                            <th>@L("Actions")</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var user in ViewBag.PageOfUserListDto)
                        {
                        <tr>
                            <td>@user.UserName</td>
                            <td>@user.Name</td>
                            <td>@user.OrgName</td>
                            <td>@user.PostName</td>
                            <td class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                    <i class="material-icons">menu</i>
                                </a>
                                <ul class="dropdown-menu pull-right">
                                    <li><a href="#" class="waves-effect waves-block edit-user" data-user-id="@user.Id" data-toggle="modal" data-target="#UserPostAndOrgModal"><i class="material-icons">edit</i>@L("Edit")</a></li>
                                   
                                </ul>
                            </td>
                        </tr>
                        }
                    </tbody>
                </table>
                
            </div>
        </div>
    </div>
</div>

@Html.PagedListPager((IPagedList)ViewBag.PageOfUserListDto, page => Url.Action("UserPostAndOrg", new { page }))

<div class="modal fade" id="UserPostAndOrgModal" tabindex="-1" role="dialog" aria-labelledby="UserEditModalLabel" data-backdrop="static">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

        </div>
    </div>
</div>